<?php
namespace App\Http\Service\User;


use App\Http\Service\Basic\BasicService;
use Config;

class UserService extends BasicService
{

    //构造函数
    function __construct()
    {
        parent::__construct();
    }


    //登录
    public function login($where = array())
    {
//        dd(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.login'), json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 'post');
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.login'), json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 'post');
    }
//    //退出登录
//    public function logout($where = array())
//    {
//        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.logout'),$where, 'get');
//    }

    //注册
    public function register($where = array())
    {
//        dd(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.register'), json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 'post');
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.register'), json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), 'post');
    }

    /**
     * @param $where
     * @return bool|mixed
     * 获取短信验证码
     */
    public function getCode($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.get_sms_code'),$where,'get');
    }

    /***************首页**************/


    /**
     * @param $where
     * @return bool|mixed|string
     * 首页信息
     */
    public function getIndexInfo($where)
    {
//        dd(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.get_index_info'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.get_index_info'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }


    /**
     * @param $where
     * @return bool|mixed|string
     * 地区列表
     */
    public function getAreaList($where)
    {
//        dd(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.get_area_list'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.get_area_list'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }


    /**
     * @param $where
     * @return bool|mixed|string
     * 即将到期列表
     */
    public function getExpiredList($where)
    {
//        dd(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.expire_list'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.expire_list'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }

    /**
     * @param $where
     * @return bool|mixed|string
     * 余额不足列表
     */
    public function getNoBalanceList($where)
    {
//        dd(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.expire_list'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.balance_not_enough'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }
    /***********用户管理***********/


    /**
     * @param $where
     * @return bool|mixed|string
     * 检查用户名是否存在
     */
    public function checkUserName($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.check_user_name'),$where, 'get');
    }

    /**
     * @param $where
     * @return bool|mixed|string
     * 添加用户账号
     */
    public function addUserAccount($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.user_account_add'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }


    /**
     * @param $where
     * @return bool|mixed|string
     * 删除用户信息
     */
    public function deleteUserAccount($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.user_account_del'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }

    /**
     * @param $where
     * @return bool|mixed|string
     * 用户列表
     */
    public function getUserAccountList($where)
    {
//        dd(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.user_account_list'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.user_account_list'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }


    /**
     * @param $where
     * @return bool|mixed|string
     * 修改用户信息
     */
    public function updateUserAccount($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.user_account_update'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }

    /**
     * @param $where
     * @return bool|mixed|string
     * 用户续费
     */
    public function renewUserAccount($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.user_account_renew'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }


    /**
     * @param $where
     * @return bool|mixed|string
     * 批量续费
     */
    public function batchRenewUserAccount($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.user_account_batch_renew'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }


    /**
     * @param $where
     * @return bool|mixed|string
     * 批量添加
     */
    public function batchAddUserAccount($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.user_account_batch_add'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }


    /**
     * @param $where
     * @return bool|mixed|string
     * 流水号
     */
    public function getSerialNumber($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.get_serial_number'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }

    /**
     * @param $where
     * @return bool|mixed|string
     * 用户信息
     */
    public function getUserInfo($where)
    {
        return $this->curlLogic->callWebServer(Config::get('custom.setting.BASE_API_PATH') . Config::get('custom.api.get_user_info'),json_encode($where,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),'post');
    }
}